package com.huyaanalysisplatform.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huyaanalysisplatform.entity.TContribution;
import com.huyaanalysisplatform.entity.TTop10Anchor;
import com.huyaanalysisplatform.service.TContributionService;
import com.huyaanalysisplatform.service.TTop10AnchorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.huyaanalysisplatform.controller.BaseController;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Huadi Group 12
 * @since 2021-08-01
 */
@RestController
@RequestMapping("/home")
@CrossOrigin
public class TContributionController extends BaseController {

    @Autowired
    TContributionService tContributionService;

    @RequestMapping({"/function14/first"})//功能14
    @ResponseBody
    public Map queryFirst() {

        Map map;
        map = tContributionService.queryFirst();
        return map;
    }

    @RequestMapping({"/function14/second"})//功能14
    @ResponseBody
    public Map querySecond() {
        Map map;
        map = tContributionService.querySecond();
        return map;
    }

    @RequestMapping({"/function14/third"})//功能14
    @ResponseBody
    public Map queryThird() {
        Map map;
        map = tContributionService.queryThird();
        return map;
    }

    @RequestMapping({"/function14/fourth"})//功能14
    @ResponseBody
    public Map queryFourth() {
        Map map;
        map = tContributionService.queryFourth();
        return map;
    }

    @RequestMapping({"/function15/first"})//功能15
    @ResponseBody
    public Map queryFirstHot() {
        Map map;
        map = tContributionService.queryFirstHot();
        return map;
    }

    @RequestMapping({"/function15/second"})//功能15
    @ResponseBody
    public Map querySecondHot() {
        Map map;
        map = tContributionService.querySecondHot();
        return map;
    }

    @RequestMapping({"/function15/third"})//功能15
    @ResponseBody
    public Map queryThirdHot() {
        Map map;
        map = tContributionService.queryThirdHot();
        return map;
    }

    @RequestMapping({"/function15/fourth"})//功能15
    @ResponseBody
    public Map queryFourthHot() {
        Map map;
        map = tContributionService.queryFourthHot();
        return map;
    }

    @RequestMapping({"/function13/contribution"})//功能15
    @ResponseBody
    public Map queryFourthHot(HttpServletRequest httpRequest) {
        Long roomNumber = Long.parseLong(httpRequest.getParameter("roomNumber"));
        Map map = new HashMap<String, Long>();
        map.put("roomNumber", roomNumber);
        map = tContributionService.queryContributions(map);
        return map;
    }

}
